package com.google.code.rsser.dao.hibernate;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.google.code.rsser.dao.FeedDAO;
import com.google.code.rsser.model.Feed;

@Repository("feedDAO")
public class HibernateFeedDAO extends AbstractGenericHibernateDAO<Feed> implements FeedDAO {

	@SuppressWarnings("unchecked")
	public Feed getByUrl(String url) {
		List<Feed> feeds = getHibernateTemplate().find("FROM Feed f WHERE f.feedUrl = ?", url);
		
		if (feeds != null && feeds.size() > 0) {
			return feeds.get(0);
		}
		
		return null;
	}

}
